/*
day434 
2020.11.4 
*/

#include<iostream>
#include<vector>
#include<cstring>
using namespace std;

class Solution {
public:
    vector<string> permutation(string S) {
		vector<string> res;
		vector<char> tem;
		vector<int> record(S.size());
		for(int i=0;i<record.size();++i)
		{
			record[i]=0;
		}
		
		help(res,tem,record,S);
		return res;
    }
    
    void help(vector<string> &res,vector<char> &tem,vector<int> &record,string S)
    {
    	if(tem.size()==S.size())
    	{
    		string tem_str(tem.begin(),tem.end());
    		res.push_back(tem_str);
    		return ;
		}
		
		for(int i=0;i<record.size();++i)
		{
			if(record[i]==0)
			{
				record[i]=1;
				tem.push_back(S[i]);
				help(res,tem,record,S);
				tem.pop_back();
				record[i]=0;
			}
		}
	}
};


int main()
{
	return 0;
}
